CHARTS
Photo by Annie Spratt on Unsplash
As a single mum you’ll discover inner strengths and capabilities you never knew you had…
— Emma-Louise Smith
df = read.csv("archetypes/worlds-women-report/figure-4-8_db.csv", header = TRUE, stringsAsFactors = FALSE) # read text file
df
# sort values and refactor
df <- df %>% arrange(desc(y1_axis)) %>% mutate(x_axis=factor(x_axis, levels=x_axis))
# create dumbbell plot
v1<-ggplot(df) +
geom_segment( aes(x = x_axis, xend = x_axis, y = y1_axis, yend = y2_axis), lineend = "butt", linejoin = "round", size=3.5, color="#d9d9d9" ) +
geom_point( aes(x = x_axis, y = y2_axis), size=3, color="#5c96d6" ) +
geom_text( aes(x = x_axis, y = y2_axis, label=y2_axis), size=3, color="black", vjust = 2.5, fontface = "bold" ) +
geom_point( aes(x = x_axis, y = y1_axis), size=3, color="#692c7d" ) +
geom_text( aes(x = x_axis, y = y1_axis, label = y1_axis), size=3, color="black", vjust = -1.5, fontface = "bold" ) +
scale_y_continuous(limits = c(0,60), breaks = c(0, 20, 40, 60), labels = c(0, 20, 40, 60)) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
theme( # remove the vertical grid lines
panel.grid.major.x = element_blank(),
# explicitly set the horizontal lines (or they will disappear too)
panel.grid.major.y = element_line( size=.1, color="#cccccc" ),
panel.grid.minor.y = element_blank()
) +
labs(title = "POVERTY RATES AMONG LONE-PARENTS BEFORE AND AFTER TRANSFERS - Figure 4.8",
subtitle = "SELECTED COUNTRIES, LATEST AVAILABLE YEAR", caption = "Source: UN Women",
x = "",
y = "Percentage")
girafe(ggobj = v1, width_svg = 1280/72, height_svg = 720/72,
options = list(opts_sizing(rescale = TRUE, width = 1.0)))
# create dumbbell plot
v2 <- ggplot(df) +
geom_point( aes(x = x_axis, y = y2_axis), size=3, color="#5c96d6" ) +
geom_point( aes(x = x_axis, y = y1_axis), size=3, color="#692c7d" )
girafe(ggobj = v2, width_svg = 1280/72, height_svg = 720/72,
options = list(opts_sizing(rescale = TRUE, width = 1.0)))
# create dumbbell plot
v3 <- ggplot(df) +
geom_segment( aes(x = x_axis, xend = x_axis, y = y1_axis, yend = y2_axis), lineend = "butt", linejoin = "round", size=3.5, color="#d9d9d9" ) +
geom_point( aes(x = x_axis, y = y2_axis), size=3, color="#5c96d6" ) +
geom_point( aes(x = x_axis, y = y1_axis), size=3, color="#692c7d" )
girafe(ggobj = v3, width_svg = 1280/72, height_svg = 720/72,
options = list(opts_sizing(rescale = TRUE, width = 1.0)))
# create dumbbell plot
v4 <- ggplot(df) +
geom_segment( aes(x = x_axis, xend = x_axis, y = y1_axis, yend = y2_axis), lineend = "butt", linejoin = "round", size=3.5, color="#d9d9d9" ) +
geom_point( aes(x = x_axis, y = y2_axis), size=3, color="#5c96d6" ) +
geom_text( aes(x = x_axis, y = y2_axis, label=y2_axis), size=3, color="black", vjust = 2.5, fontface = "bold" ) +
geom_point( aes(x = x_axis, y = y1_axis), size=3, color="#692c7d" ) +
geom_text( aes(x = x_axis, y = y1_axis, label = y1_axis), size=3, color="black", vjust = -1.5, fontface = "bold" )
girafe(ggobj = v4, width_svg = 1280/72, height_svg = 720/72,
options = list(opts_sizing(rescale = TRUE, width = 1.0)))
# sort values and refactor
df <- df %>% arrange(desc(y1_axis)) %>% mutate(x_axis=factor(x_axis, levels=x_axis))
# create dumbbell plot
v5 <- ggplot(df) +
geom_segment( aes(x = x_axis, xend = x_axis, y = y1_axis, yend = y2_axis), lineend = "butt", linejoin = "round", size=3.5, color="#d9d9d9" ) +
geom_point( aes(x = x_axis, y = y2_axis), size=3, color="#5c96d6" ) +
geom_text( aes(x = x_axis, y = y2_axis, label=y2_axis), size=3, color="black", vjust = 2.5, fontface = "bold" ) +
geom_point( aes(x = x_axis, y = y1_axis), size=3, color="#692c7d" ) +
geom_text( aes(x = x_axis, y = y1_axis, label = y1_axis), size=3, color="black", vjust = -1.5, fontface = "bold" ) +
scale_y_continuous(limits = c(0,60), breaks = c(0, 20, 40, 60), labels = c(0, 20, 40, 60)) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
theme( # remove the vertical grid lines
panel.grid.major.x = element_blank(),
# explicitly set the horizontal lines (or they will disappear too)
panel.grid.major.y = element_line( size=.1, color="#cccccc" ),
panel.grid.minor.y = element_blank()
) +
labs(title = "POVERTY RATES AMONG LONE-PARENTS BEFORE AND AFTER TRANSFERS - Figure 4.8",
subtitle = "SELECTED COUNTRIES, LATEST AVAILABLE YEAR", caption = "Source: UN Women",
x = "",
y = "Percentage")
girafe(ggobj = v5, width_svg = 1280/72, height_svg = 720/72,
options = list(opts_sizing(rescale = TRUE, width = 1.0)))
## [1] U. Women. _SDGs under review in 2019: What progress for women? | UN
## Women Data Hub_. data.unwomen.org, Sep. 2019. <URL:
## https://data.unwomen.org/features/sdgs-under-review-2019-what-progress-women>
## (visited on 02/02/2021).